package cn.com.sassali.dynamic;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @ClassName CglibMethodInterceptor
 * @Description     调用拦截器
 * @Author lujiansen
 * @date 2020/4/26 9:02 下午
 */
public class CglibMethodInterceptor implements MethodInterceptor {

    public Object intercept(Object obj, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println("开始CGLib动态代理 === ");
        Object object = methodProxy.invokeSuper(obj, args);
        System.out.println("结束CGLib动态代理 === ");
        return object;
    }

}
